import http from '../../common/request'
import { AxiosResponse } from 'axios'
export class ProjectFinder implements Finder<Project> {
  private _project: Project[] = []
  private _projectKeywords: keywordsOf<Project> = {}

  async find(
    keywords?: keywordsOf<Project>,
  ): Promise<ServiceReturnList<Project>> {
    if (keywords) this._projectKeywords = keywords
   
    const response = await http.post('/data/projectList.json',this._projectKeywords) as AxiosResponse<ServiceReturnList<Project>>
    this._project = response.data.data;
    return response.data;
  }

  get project(): Project[] {
    return this._project
  }

  get keywords(): keywordsOf<Project> {
    return this._projectKeywords
  }
}
